package com.wang.sort2;

/**
 * @Author: along
 * @Create: 2021/4/19 10:17
 * @Description:zh折纸问题(打印凹凸折痕，二叉树的中序遍历)
 */
public class Demo15_PaperFolding {
    //左子树的头全为凹折痕，右子树的头全为凸折痕
    public static void printAllFolds(int N) {
        printProcess(1, N, true);
    }
    //递归过程 来到了某一个节点
    //i是节点的层数 N是总层数，需要传入
    //down == true "凹"   down == false  "凸"
    public static void printProcess(int i, int N, boolean down) {
        if(i > N) {
            return;
        }
        printProcess(i + 1, N, true);
        System.out.println(down ? "凹" : "凸");
        printProcess(i + 1, N, false);
    }
    //for test
    public static void main(String[] args) {
        int N = 4;
        printAllFolds(N);
    }
}
